home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tool-inc.zip / FILEDATE.INC < prev    next >
Text File  |  1989-06-02  |  1KB  |  46 lines

  1.  
  2. (*
  3.  * Copyright 1987, 1989 Samuel H. Smith;  All rights reserved
  4.  *
  5.  * This is a component of the ProDoor System.
  6.  * Do not distribute modified versions without my permission.
  7.  * Do not remove or alter this notice or any other copyright notice.
  8.  * If you use this in your own program you must distribute source code.
  9.  * Do not use any of this in a commercial product.
  10.  *
  11.  *)
  12.  
  13. (*
  14.  * Return the modification date of a file as a real.
  15.  * This real will always be larger for later file dates.
  16.  *
  17.  * The returned date, if printed with writeln(date:11:4) will give
  18.  * the following format:
  19.  *        yymmdd.hhmm
  20.  *
  21.  *)
  22.  
  23. function filedate (filename:      anystring): real;
  24. var
  25.    DirInfo:     SearchRec;
  26.    Stamp:       DateTime;
  27.  
  28. begin
  29.    FindFirst(filename,$21,DirInfo);
  30.    if (DosError <> 0) then
  31.       filedate := 0
  32.    else
  33.  
  34.    begin
  35.       UnpackTime(DirInfo.time, Stamp);
  36.       filedate := int(Stamp.Year)  *10000.0 +
  37.                   int(Stamp.Month) *100.0 +
  38.                   int(Stamp.Day) +
  39.                   int(Stamp.Hour)  / 100.0 +
  40.                   int(Stamp.Min)   / 10000.0 +
  41.                   int(Stamp.Sec)   / 1000000.0;
  42.    end;
  43.  
  44. end;
  45.  
  46.